// 创建一个store
import { defineStore } from 'pinia'
import { ref } from 'vue'

export const useNewsStore = defineStore('news', () => {
  // 1. 使用ref或reactive函数定义全局变量和修改变量方法
  const activeId = ref(0)
  const changeChannel = (id: number) => {
    activeId.value = id
  }
  // 2. 返回定义的变量和修改变量方法
  return { activeId, changeChannel }
})
